var form = document.getElementById("mainform2");
    var findVal = prompt('Find this:', '');
    var replaceVal = prompt('Replace with:', '');
for (var i = 0; i < form.elements.length; i++) {
    var e = form.elements[i];
    if (e.type === "text" && (/Name/.test(e.name) && e.size == 25 || /City/.test(e.name) && e.size == 35 || /Street/.test(e.name) && e.size == 35 || /Notes/.test(e.name) && e.size == 20) && e.value) {
        if (findVal) {
            var findRegex = new RegExp(findVal.replace(/[-[\]{}()*+?.,\\^$|#\s]/g, '\\$&'), 'gi');
            var resultsNumber = e.value.match(findRegex);
            if (resultsNumber) {
                    if (confirm('Are you sure you want to replace ' + resultsNumber.length + ' occurence of %22' + findVal + '%22 with %22' + replaceVal + '%22?')) e.value = e.value.replace(findRegex, replaceVal);
            }
        }
    }
}